﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using App.Business.Entities.Party;
using App.Business.Party;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RrslLite.Net.Messages;
using RrslLite.Net.Proxies;

namespace App.Test.Silverlight
{
    [TestClass]
    public class AsyncMessageProcessorProxyTEST
    {
        private static AsyncMessageProcessorProxy GetAsyncMessageProcessorProxy()
        {
            return new AsyncMessageProcessorProxy("basicHttp_IWcfMessageService");
        }

        [TestMethod]
        public void AsyncMessageProcessorProxy_InvokeOperationsAsync()
        {
            var testee = GetAsyncMessageProcessorProxy();

            var messages = new Message[]
                               {
                                   new Message(Guid.NewGuid())
                                       {
                                           OperationContainerName = "IPersonFacade",
                                           OperationName = "GetActivePersonsFor",
                                           OperationParameters = new Dictionary<string,object>() { { "country", "CZ" } }
                                       },
                                   new Message(Guid.NewGuid())
                                       {
                                           OperationContainerName = "ICountryFacade",
                                           OperationName = "GetByCode",
                                           OperationParameters = new Dictionary<string,object>() { { "country", "CZ" } }
                                       }
                               };

            testee.InvokeOperationsAsync(messages,
               (e) =>
                   {
                       Assert.IsNotNull(e.Result);
                       Assert.IsTrue(e.Result.Length > 0);
                   }
                );
        }
    }
}
